package com.ikun.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.ikun.dao.PropertyPaymentsDao;
import com.ikun.entity.PropertyPayments;
import com.ikun.service.PropertyPaymentsService;

/**
 * @ClassName: PropertyPaymentsServiceImpl
 * @Author: 吴思伟
 * @CreateTime: 2025-04-06 00:22
 * @Description: TODO
 */
@Service
public class PropertyPaymentsServiceImpl implements PropertyPaymentsService {
    @Autowired
    private PropertyPaymentsDao propertyPaymentsDao;

    @Override
    @Transactional
    public String addPropertyPayments(PropertyPayments propertyPayments) {
        PropertyPayments propertyPayments1 =
            propertyPaymentsDao.findPropertyPaymentsByOwnerId(propertyPayments.getOwnerId());
        if (propertyPayments1 == null) {
            propertyPaymentsDao.addPropertyPayments(propertyPayments);
            return "缴费成功";
        }
        return "没有未到期的缴费记录";
    }
}
